<?php

/**
 * 前台 index 模块 Controller
 * ============================================================================
 * TBlog TBlog博客系统　BY Tmac PHP MVC framework
 * $Author: zwt007 $  <zwttmac@qq.com>
 * $Id: index.php 39 2011-07-11 17:12:35Z zwt007 $
 * http://www.t-mac.org；
 */
class indexAction extends Action
{

    private $tmp_model;
    private $show_model;    

    public function _init()
    {
        $this->assign('action', $_GET['TMAC_ACTION']);
        $this->article_model = Tmac::model('article', 'admin');
        $this->tmp_model = Tmac::model('index');
        $this->difang_model = Tmac::model('difang');
        $this->show_model = Tmac::model('show');

        $username = 'beijing';
        $this->userinfo = $this->difang_model->getUserinfo($username);
        
        $this->config = $this->tmp_model->getCommon($this->userinfo);
        
        $this->assign('userinfo', $this->userinfo);
    }

    public function index()
    {
        /*
        $index_option = Tmac::config('index.option');

        //取category栏目数组
        $index_category_array = $this->tmp_model->getIndexCategory();

        //取图片友情链接        
        $flink_array = $this->tmp_model->getlink(0, 'img', 'link_img_array', 4);

        $this->assign('index_category_array', $index_category_array);
        $this->assign('index_option', $index_option);
        $this->V();
        */
        //关于我们        
        $catinfo = $this->show_model->getCategoryInfoById(9, $this->userinfo['uid']);

        //会议酒店
        $hyjd_array = $this->show_model->getHotelListNoPage($this->userinfo['uid'], 4);
        //成功安案例
        $anli_array = $this->show_model->getAnliListNoPage($this->userinfo['uid'], 6);
        //会议服务
        $hyfw_catinfo = $this->show_model->getCategoryInfoById(1, $this->userinfo['uid']);
        //舞美工程 案例
        $wmgc_array = $this->show_model->getArticleListNoPage(71, $this->userinfo['uid'], 8);
        //展览展示 案例
        $zlzs_array = $this->show_model->getArticleListNoPage(25, $this->userinfo['uid'], 4);
        //展览展示
        $swkc_array = $this->show_model->getArticleNewsListNopage(3, $this->userinfo['uid'], 6);
        //广告设计 案例
        $ggsj_array = $this->show_model->getArticleListNoPage(27, $this->userinfo['uid'], 6);
        //资讯中心
        $news_array = $this->show_model->getArticleNewsListNopage(33, $this->userinfo['uid'], 5);
        //会议常识
        $hycs_cid = 70;
        $hycs_array = $this->show_model->getArticleNewsListNopageB($hycs_cid, $this->userinfo['uid'], 5);
        //友情链接
        $flink_array = $this->tmp_model->getlink($this->userinfo['uid'], 'noimg', 'link_img_array', 50);
        //会议考察广告                
        $index_hykc_ad_array = $this->tmp_model->ShowAdMore($this->userinfo['uid'], 'index_hykc_ad');

        $this->assign('aboutus', $catinfo['category_content']);
        $this->assign('hyjd_array', $hyjd_array);
        $this->assign('anli_array', $anli_array);
        $this->assign('hyfw', htmlspecialchars(strip_tags($hyfw_catinfo['category_content'])));
        $this->assign('wmgc_array', $wmgc_array);
        $this->assign('zlzs_array', $zlzs_array);
        $this->assign('swkc_array', $swkc_array);
        $this->assign('ggsj_array', $ggsj_array);
        $this->assign('news_array', $news_array);
        $this->assign('hycs_array', $hycs_array);
        $this->assign('index_hykc_ad_array', $index_hykc_ad_array);

        $this->V('difang_index');        
    }

    public function news()
    {
        $cid = intval($this->getParam('cid'));
        if (empty($cid)) {
            $this->redirect('请选择栏目!');
            exit();
        }
        $info = $this->tmp_model->getIndexCategoryInfo($cid);

        $index_option = Tmac::config('index.option');
        //取category栏目数组
        $index_category_array = $this->tmp_model->getIndexCategory();

        $this->assign('index_category_array', $index_category_array);
        $this->assign('index_option', $index_option);
        $this->assign('info', $info);
        $this->assign('cid', $cid);
        $this->V('index_news');
    }

}